#include <stdio.h>
#include <math.h>

int test_array[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};

static float standard_deviation(int *ptr, int len)
{
    float average = 0;
    float deviation = 0;

    for (int i = 0; i < len; i++)
    {
        average += ptr[i];
    }

    average = average / len;

    for (int j = 0; j < len; j++)
    {
        deviation += pow(ptr[j] - average, 2);
    }

    return sqrt(deviation / 10);
}

int main(int argc, char *argv[])
{
    float data = 0;
    data = standard_deviation(test_array, sizeof(test_array) / sizeof(test_array[0]));
    printf("standard deviation is %f\r\n", data);

    return 0;
}
